<?php

use Yolo\Di\DI;
use Yolo\Logs\Log;

if (!function_exists('logDebug')) {

    /**
     * @psalm-param array{
     *     action: string,
     *     message: string,
     *     data?: array<string, mixed>
     * } $log
     * @param array $log
     * @return void
     */
    function logDebug(array $log): void
    {
        DI::use(Log::class)->debug($log);
    }
}

if (!function_exists('logInfo')) {

    /**
     * @psalm-param array{
     *     action: string,
     *     message: string,
     *     data?: array<string, mixed>
     * } $log
     * @param array $log
     * @return void
     */
    function logInfo(array $log): void
    {
        DI::use(Log::class)->info($log);
    }
}

if (!function_exists('logWarn')) {

    /**
     * @psalm-param array{
     *     action: string,
     *     message: string,
     *     data?: array<string, mixed>
     * } $log
     * @param array $log
     * @return void
     */
    function logWarn(array $log): void
    {
        DI::use(Log::class)->warn($log);
    }
}

if (!function_exists('logError')) {

    /**
     * @psalm-param array{
     *     action: string,
     *     message: string,
     *     data?: array<string, mixed>
     * } $log
     * @param array $log
     * @return void
     */
    function logError(array $log): void
    {
        DI::use(Log::class)->error($log);
    }
}
